using System.Data;
using ET;
namespace DA
{
	public class Contact_DAL
	{
	private clsConnect cls = new clsConnect();

	#region Getdata
	public DataTable BindGirdtb_Contact(string keywords)
	{
	return cls.Search("sp_tb_Contact_Search", "@KeyWords", keywords);
	}
    public DataTable BindGirdtb_ContactDetail(int id)
    {
        return cls.GetData_ID_Int("sp_tb_Contact_Detail", "@Contact_ID", id);
    }
	#endregion

	#region Insert
	public bool Inserttb_Contact(Contact_ET data)
	{
	cls.CreateNewSqlCommand();
	cls.AddParameter("@Contact_Alias", data.Contact_Alias);
	cls.AddParameter("@Contact_Name", data.Contact_Name);
	cls.AddParameter("@Contact_BirthDay", data.Contact_BirthDay);
	cls.AddParameter("@Contact_Gender", data.Contact_Gender);
	cls.AddParameter("@Job_ID", data.Job_ID);
	cls.AddParameter("@Contact_Vocative", data.Contact_Vocative);
	cls.AddParameter("@Department_ID", data.Department_ID);
	cls.AddParameter("@Contact_Phone", data.Contact_Phone);
	cls.AddParameter("@Contact_MobilePhone", data.Contact_MobilePhone);
	cls.AddParameter("@Contact_Email", data.Contact_Email);
	cls.AddParameter("@Contact_Address", data.Contact_Address);
	cls.AddParameter("@District_ID", data.District_ID);
	cls.AddParameter("@Contact_User_Add", data.Contact_User_Add);
	cls.AddParameter("@Contact_Date_Add", data.Contact_Date_Add);
	cls.AddParameter("@Contact_Computer_Add", data.Contact_Computer_Add);
	cls.AddParameter("@Contact_User_Modify", data.Contact_User_Modify);
	cls.AddParameter("@Contact_Date_Modify", data.Contact_Date_Modify);
	cls.AddParameter("@Contact_Computer_Modify", data.Contact_Computer_Modify);
	cls.ExecuteNonQuery("sp_tb_Contact_Insert");
	return true;
	}
	#endregion

	#region Update
	public bool Updatetb_Contact(Contact_ET data)
	{
	cls.CreateNewSqlCommand();
	cls.AddParameter("@Contact_ID", data.Contact_ID);
	cls.AddParameter("@Contact_Alias", data.Contact_Alias);
	cls.AddParameter("@Contact_Name", data.Contact_Name);
	cls.AddParameter("@Contact_BirthDay", data.Contact_BirthDay);
	cls.AddParameter("@Contact_Gender", data.Contact_Gender);
	cls.AddParameter("@Job_ID", data.Job_ID);
	cls.AddParameter("@Contact_Vocative", data.Contact_Vocative);
	cls.AddParameter("@Department_ID", data.Department_ID);
	cls.AddParameter("@Contact_Phone", data.Contact_Phone);
	cls.AddParameter("@Contact_MobilePhone", data.Contact_MobilePhone);
	cls.AddParameter("@Contact_Email", data.Contact_Email);
	cls.AddParameter("@Contact_Address", data.Contact_Address);
	cls.AddParameter("@District_ID", data.District_ID);
	cls.AddParameter("@Contact_User_Add", data.Contact_User_Add);
	cls.AddParameter("@Contact_Date_Add", data.Contact_Date_Add);
	cls.AddParameter("@Contact_Computer_Add", data.Contact_Computer_Add);
	cls.AddParameter("@Contact_User_Modify", data.Contact_User_Modify);
	cls.AddParameter("@Contact_Date_Modify", data.Contact_Date_Modify);
	cls.AddParameter("@Contact_Computer_Modify", data.Contact_Computer_Modify);
	cls.ExecuteNonQuery("sp_tb_Contact_Update");
	return true;
	}
	#endregion

	#region Delete
	public bool Deletetb_Contact(int id)
	{
        cls.Delete("sp_tb_Contact_Delete", "@Contact_ID", id);
	return true;
	}
	#endregion
	}
}